<admintpl file="header" />


<link href="__TMPL__Public/assets/css/infomation.css" rel="stylesheet" />
<link type="text/css" href="__PUBLIC__/js/select2/select2.min.css" rel="stylesheet" />
</head>
<body>
    <div class="wrap">
        <ul class="nav nav-tabs">
            <li><a href="{:U('SupervisionReport/index')}">监理报告管理</a></li>
            <li><a href="{:U('SupervisionReport/add')}">新增监理报告</a></li>
            <li class="active"><a href="{:U('SupervisionReport/edit', array('id'=>I('request.id/s','')))}">编辑监理报告</a></li>
        </ul>
        <form method="post" class="form-horizontal js-ajax-form form-inline tg" action="{:U('SupervisionReport/edit_post')}">
        	<input type="hidden" name="id" value="{$result.id}" />
            <section class="tab-pane active fade in" id="access">
                <div class="row">
                    <div class="col-xs-12 col-md-12 col-lg-12">
                        <div class="panel panel-info">
                            <div class="panel-body">
                                <div class="row tg-header">
                                    <div class="col-md-12 text-center">
                                        <h3>监理报告</h3>
                                        <hr />
                                    </div>
                                    <div class="col-md-12">
                                        <p class="tg-to"><b>工程名称:</b><input type="text" class="input-xt input-deptname" value="{$job_name}" /></p>
                                        <p class="pull-right tg-serialnum"><b>编号:</b><input class="input-xt" name="code" value="{$result.code}" /></p>
                                    </div>
                                </div>
                                <div class="well">
                                    <p>致：<input type="text" class="input-xt input-deptname" name="manager_department" value="{$result.manager_department}" />(主管部门)</p>
                                    <p class="indent20">
                                        由<input type="text" class="input-xt input-deptname" name="executing_department" value="{$result.executing_department}" />（施工单位）施工的<input type="text" class="input-xt input-deptname" name="sub_project" value="{$result.sub_project}" />（工程部位），存在安全事故隐患。我方已于<input type="text" class="js-date input-xt" name="supervision_notice_date" value="{$result.supervision_notice_date}" />发出编号为<input type="text" class="input-xt input-num" name="supervision_notice_code" value="{$result.supervision_notice_code}" />的《监理通知单》/《工程暂停令》，但施工单位未整改/停工。
                                    </p>
                                    <p class="indent20">
                                        特此报告。
                                    </p>
                                    <p class="indent20">
                                        附件：
                                        <div class="controls">
                                            <a class="btn upBtn btn-primary" href="javascript:void(0);">上传</a>
                                            <input type="file" id="upFile" name="upFile" style="display:none" />
                                        </div>
                                        <foreach name="results" item="vo">
                                            <div class='controls' style='margin-top:10px;margin-left:20px'>
                                                <a class="fileDownload" path="{$vo.file_path}" name="{$vo.file_name}" data-type="{$vo.file_type}">{$vo.file_name}</a>
                                                <a href='javascript:void(0)' class='btn btn-danger btn-xs delFile' value="{$vo.id}">删除</a>
                                            </div>
                                        </foreach>
                                    </p>                          
                                    <div class="signature">
                                        <p>项目监理机构(盖章)</p>
                                        <p>总监理工程师(签字)</p>
                                    </div>
                                    <p class="signature-date">
                                        <span>年</span>
                                        <span>月</span>
                                        <span>日</span>
                                    </p>
                                    <p>
                                    <label>抄送：</label>
                                    <select name="carbon_copy_department[]" id="carbon_copy_department" style="width:60%;" class="select2" multiple="multiple" data-placeholder="选择抄送单位">
                                            <foreach name="data" item="vo">
                                                <option value="{$vo.id}">{$vo.department_name}</option>
                                            </foreach>
                                        </select>
                                        (施工单位)
                                    </p>

                                </div>
                                <p class="text-muted tg-note">
                                    <small>注：本表一式三份，项目监理机构、建设单位、施工单位各一份。</small>
                                </p>
                                <div class="form-actions">
                                    <button type="submit" class="btn btn-primary js-ajax-submit">{:L('SAVE')}</button>
                                    <if condition="$Role == 3 || $Role == 0">
                                        <input type="hidden" value="{$result.is_publish}" name="is_publish" id="is_publish">
										<input type="submit" class="btn btn-warning" id="btnPublish" value="发布"/>
                                    </if>
                                    <a class="btn btn-default" href="javascript:history.back(-1);">{:L('BACK')}</a>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>

            </section>
        </form>
    </div>
    <!-- <script src="__PUBLIC__/js/jquery.js"></script> -->
    <script src="__PUBLIC__/js/common.js"></script>
    <script src="__PUBLIC__/js/select2/select2.min.js"></script>
    <script src="__PUBLIC__/js/select2/i18n/zh-cn.js"></script>
    <script src="__PUBLIC__/js/select2/select2.default.js"></script>
    <script type="text/javascript">
		$(document).ready(function(e) {
			/*$("input[name='executing_department']").blur(function(){
				$("#copy").val($(this).val());
			});*/
			
			// 选择图片
            $(document).on("click", ".upBtn", function(e) {
                $("#upFile").click();
            });
            // 文件选择器change事件
            $("#upFile").on("change", function(){
                UploadFile("{:U('SupervisionReport/upload')}", "supervision_report");
            });
            $(document).on("click", ".delFile", function(){
                if($(this).attr("value") != undefined){
                    delFile("{:U('SupervisionReport/delFile')}", $(this).attr("value"), $(this))
                } else {
                    $(this).closest("div").remove();
                }
            });
		
            //实现抄送
            $(function () {
                $("#carbon_copy_department").select2().val({$dept2}).trigger('change');
            });

            $(".btn-primary").click(function () {
                var reslist = $("#carbon_copy_department").select2("data");    //多选
                console.log(reslist);
                return true;
            });
        });
	</script>
</body>
</html>